<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js" integrity="sha256-iM4Yzi/zLj/IshPWMC1IluRxTtRjMqjPGd97TZ9yYpU=" crossorigin="anonymous"></script>
  <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Cousine|Inconsolata" rel="stylesheet">
  <link rel="shortcut icon" type="image/png" href="/favicon.png">

  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/css/css/fontawesome-all.min.css">
  <link rel="stylesheet" href="/css/css/work-sans-v7.css">
  <script src="/js/main.js"></script>

  <!-- Begin Jekyll SEO tag v2.6.1 -->
<title>RB: Get Post Details | Hive Developer</title>
<meta name="generator" content="Jekyll v4.0.0" />
<meta property="og:title" content="RB: Get Post Details" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Understand and use the most common fields of the requested content." />
<meta property="og:description" content="Understand and use the most common fields of the requested content." />
<link rel="canonical" href="get_post_details.html" />
<meta property="og:url" content="get_post_details.html" />
<meta property="og:site_name" content="Hive Developer" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-08-26T11:52:22-07:00" />
<script type="application/ld+json">
{"description":"Understand and use the most common fields of the requested content.","mainEntityOfPage":{"@type":"WebPage","@id":"get_post_details.html"},"@type":"BlogPosting","url":"get_post_details.html","headline":"RB: Get Post Details","dateModified":"2020-08-26T11:52:22-07:00","datePublished":"2020-08-26T11:52:22-07:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->


  
</head>
<body>
<header>
  <h1>
    <button type="button" class="open-nav" id="open-nav"></button>
    <a href="/"  class="logo-link"><img src="/images/logotype_black.svg" height="40" alt="Hive Developer logo"></a>
  </h1>

  
  <form action="/search/" method="get">
    <input type="text" name="q" id="search-input" placeholder="Search">
    <input type="submit" value="Search" style="display: none;">
  </form>
  

  <div id="sidebar" class="sidebar">
	
	
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/">
		<h6 class="ctrl-nav-section title">Introduction</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/#introduction-welcome">Welcome to Hive</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/quickstart/">
		<h6 class="ctrl-nav-section title">Quickstart</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/quickstart/#quickstart-choose-library">Choose Library</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-hive-full-nodes">Hive Nodes</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-testnet">Hive Testnet</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/tutorials/">
		<h6 class="ctrl-nav-section title">Tutorials</h6>
		<ul class="cont-nav-section content">
			
				
					
						<li><a href="/tutorials/#tutorials-javascript">Javascript</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-python">Python</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-ruby">Ruby</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-recipes">Recipes</a></li>
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/services/">
		<h6 class="ctrl-nav-section title">Services</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/services/#services-hive-blog">hive.blog</a></li>
						
					
						
						<li><a href="/services/#services-hivesigner">HiveSigner</a></li>
						
					
						
						<li><a href="/services/#services-jussi">Jussi</a></li>
						
					
						
						<li><a href="/services/#services-imagehoster">ImageHoster</a></li>
						
					
						
						<li><a href="/services/#services-dhf">DHF</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/apidefinitions/">
		<h6 class="ctrl-nav-section title">Appbase API</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/apidefinitions/#apidefinitions-condenser-api">Condenser Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-bridge">Bridge</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-by-key-api">Account By Key Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-history-api">Account History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-block-api">Block Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-database-api">Database Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-debug-node-api">Debug Node Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-follow-api">Follow Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-jsonrpc">Jsonrpc</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-market-history-api">Market History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-network-broadcast-api">Network Broadcast Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rc-api">Rc Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-reputation-api">Reputation Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rewards-api">Rewards Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-tags-api">Tags Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-transaction-status-api">Transaction Status Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-witness-api">Witness Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops">Broadcast Ops</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops-communities">Broadcast Ops Communities</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/resources/">
		<h6 class="ctrl-nav-section title">Resources</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/resources/#resources-overview">Overview</a></li>
						
					
						
						<li><a href="/resources/#resources-client-libs">Client Libraries</a></li>
						
					
						
						<li><a href="/resources/#resources-bluepaper">Bluepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-whitepaper">Whitepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-tools">Tools</a></li>
						
					
						
						<li><a href="/resources/#resources-hivesigner-libs">Hivesigner Libs</a></li>
						
					
						
						<li><a href="/resources/#resources-hive-keychain">Hive Keychain</a></li>
						
					
						
						<li><a href="/resources/#resources-developeradvocate">Community & Help</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/glossary/">
		<h6 class="ctrl-nav-section title">Glossary</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/glossary/#glossary-chain-basics">Chain Basics</a></li>
						
					
						
					
						
						<li><a href="/glossary/#glossary-governance">Governance</a></li>
						
					
						
						<li><a href="/glossary/#glossary-transactions">Transactions</a></li>
						
					
						
						<li><a href="/glossary/#glossary-api">API</a></li>
						
					
						
						<li><a href="/glossary/#glossary-market">Market</a></li>
						
					
				
			
		</ul>
	</section>
	
</div>



  <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
</header>
<div class="main" id="top">
  <div class="hero">
    <h1 class="hero__h1">Hive Developer Portal </h1>
    <img class="hero__img" src="/images/honey-comb-92.png" style="position: relative; top: 10px;" />
  </div>
  <section id="tutorials-ruby-get-post-details" class="row tutorials-ruby-get-post-details">
	<h3>
		<a id="tutorials-ruby-get-post-details">
			RB: Get Post Details
			
		</a>
	</h3>
	
		<span class="description"><p>Understand and use the most common fields of the requested content.</p>
</span>
	

	<p><span class="fa-pull-left top-of-tutorial-repo-link"><span class="first-word">Full</span>, runnable src of <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/ruby/tutorials/05_get_post_details">Get Post Details</a> can be downloaded as part of: <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/ruby">tutorials/ruby</a>.</span>
<br /></p>

<h3 id="intro">Intro</h3>

<p>This tutorial fetches the contents of a single post and explains all data related to that post.</p>

<p>We will also describe the most commonly used fields from the response object.</p>

<h3 id="sections">Sections</h3>

<ol>
  <li><a href="#making-the-api-call">Making the api call</a> - Use steem-rb to a specific post
    <ol>
      <li><a href="#example-api-call">Example api call</a> - make the call in code</li>
      <li><a href="#example-api-call-using-script">Example api call using script</a> - using our tutorial script</li>
      <li><a href="#example-output">Example Output</a> - output from a successful call</li>
    </ol>
  </li>
  <li><a href="#post-fields">Post Fields</a> - General use of the method to determine …
    <ol>
      <li><a href="#parent_author"><code class="highlighter-rouge">parent_author</code></a> - if the content is a root post or reply</li>
      <li><a href="#last_update-and-created"><code class="highlighter-rouge">last_update</code> and <code class="highlighter-rouge">created</code></a> - if the content has been modified</li>
      <li><a href="#cashout_time"><code class="highlighter-rouge">cashout_time</code></a> - if the content has reached payout</li>
      <li><a href="#beneficiaries"><code class="highlighter-rouge">beneficiaries</code></a> - reward routes other accounts</li>
      <li><a href="#active_votes"><code class="highlighter-rouge">active_votes</code></a> - all votes applied</li>
      <li><a href="#json_metadata"><code class="highlighter-rouge">json_metadata</code></a> - things like <code class="highlighter-rouge">tags</code> and <code class="highlighter-rouge">app</code></li>
    </ol>
  </li>
  <li><a href="#script">Script</a> - Delving into the example script.</li>
  <li><a href="#to-run">To Run</a> - Running the example.</li>
</ol>

<h3 id="making-the-api-call">Making the api call</h3>

<p>To request a specific post we use the <code class="highlighter-rouge">get_content</code> method:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">api</span> <span class="o">=</span> <span class="no">Radiator</span><span class="o">::</span><span class="no">Api</span><span class="p">.</span><span class="nf">new</span>

<span class="n">api</span><span class="p">.</span><span class="nf">get_content</span><span class="p">(</span><span class="n">author</span><span class="p">,</span> <span class="n">permlink</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">content</span><span class="o">|</span>
  <span class="c1"># .</span>
  <span class="c1"># ... your code here</span>
  <span class="c1"># .</span>
<span class="k">end</span>
</code></pre></div></div>

<h4 id="example-api-call">Example api call</h4>
<p>If we want to get the post “announcing-the-steem-developer-portal” by user @steemitdev</p>
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">api</span><span class="p">.</span><span class="nf">get_content</span><span class="p">(</span><span class="s2">"steemitdev"</span><span class="p">,</span> <span class="s2">"announcing-the-steem-developer-portal"</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">content</span><span class="o">|</span> <span class="o">...</span>
</code></pre></div></div>

<h4 id="example-api-call-using-script">Example api call using script</h4>
<p>And to do the same with our tutorial script</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ruby get_post_details.rb https://steemit.com/steemdev/@steemitdev/announcing-the-steem-developer-portal
</code></pre></div></div>

<h4 id="example-output">Example Output</h4>

<p>From the example we get the following output from our script</p>

<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Post by steemitdev
	title: Announcing the Steem Developer Portal!
	permlink: announcing-the-steem-developer-portal
	category: steemdev
	body_length: 2342 (381 words)
	posted at: 2017-10-30T16:34:27, updated at: 2017-10-30T16:34:27, active at: 2018-04-11T10:34:00
	children: 66
	net_rshares: 0
	vote_rshares: 0
	payout:
		max_accepted_payout: 0.000 SBD
		percent_steem_dollars: 100.00 %
		payout at: 2017-11-06T16:34:27 (235.2 days ago)
		author_rewards: 0.000 SBD
		curator_payout_value: 0.000 SBD
		total_payout_value: 0.000 SBD
	promoted: 0.000 SBD
	total_vote_weight: 0
	reward_weight: 100.00 %
	net_votes: 181, upvotes: 234, downvotes: 1, unvotes: 0, total: 235, top voter: thejohalfiles
	allow_replies: true
	allow_votes: true
	allow_curation_rewards: true
	author_reputation: 14487360227924
	tags: steemdev, steem, dev
	app: steemit/0.1
</code></pre></div></div>

<h3 id="post-fields">Post fields</h3>

<p>Most console applications that use the <code class="highlighter-rouge">get_content</code> method are probably looking for the <code class="highlighter-rouge">body</code> field.  But there are many other fields to look at.  Let’s break them down by use:</p>

<h4 id="parent_author"><code class="highlighter-rouge">parent_author</code></h4>

<p>In our script (<code class="highlighter-rouge">get_post_details.rb</code>), we use the ruby statement:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">content</span><span class="p">.</span><span class="nf">parent_author</span><span class="p">.</span><span class="nf">empty?</span>
</code></pre></div></div>

<p>With the above idiom, your application can determine if the content is a root post or reply.  If it’s empty, then you’re working with a root post, otherwise, it’s a reply.</p>

<p>Once you know you’re dealing with a reply, other fields can be useful for additional details.  For instance, <code class="highlighter-rouge">root_author</code>, <code class="highlighter-rouge">root_permlink</code>, and <code class="highlighter-rouge">root_title</code> can be used to figure out what the original post details are, even if the reply is deeply nested.</p>

<h4 id="last_update-and-created"><code class="highlighter-rouge">last_update</code> and <code class="highlighter-rouge">created</code></h4>

<p>In our script, we use the ruby statement:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">content</span><span class="p">.</span><span class="nf">last_update</span> <span class="o">==</span> <span class="n">content</span><span class="p">.</span><span class="nf">created</span>
</code></pre></div></div>

<p>With the above idiom, your application can determine if the content has been modified since it was originally posted.  If they are the same, then there has been no modification.</p>

<h4 id="cashout_time"><code class="highlighter-rouge">cashout_time</code></h4>

<p>In our script, we use the ruby statement:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">(</span><span class="n">cashout</span> <span class="o">=</span> <span class="no">Time</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="n">content</span><span class="p">.</span><span class="nf">cashout_time</span> <span class="o">+</span> <span class="s1">'Z'</span><span class="p">)</span> <span class="o">-</span> <span class="no">Time</span><span class="p">.</span><span class="nf">now</span><span class="p">.</span><span class="nf">utc</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span>
</code></pre></div></div>

<p>With the above idiom, you can use <code class="highlighter-rouge">cashout_time</code> to determine if the content has reached payout.  If <code class="highlighter-rouge">cashout_time</code> is in the future, the content has not been paid yet.  You can determine the possible future payout by inspecting <code class="highlighter-rouge">pending_payout_value</code>.</p>

<p>You will note that we must parse the string found in <code class="highlighter-rouge">content.cashout_time</code> by appending <code class="highlighter-rouge">Z</code> (Zulu Time, aka UTC) in order for <code class="highlighter-rouge">Time.parse</code> to get the right timezone.</p>

<p>Even before payout, you can determine what the <code class="highlighter-rouge">max_accepted_payout</code> is.  Most often, this is set to one of two values by the author:</p>

<ul>
  <li><code class="highlighter-rouge">1000000.000 SBD</code> - Accepted Payout</li>
  <li><code class="highlighter-rouge">0.000 SBD</code> - Declined Payout</li>
</ul>

<p>In addition to <code class="highlighter-rouge">max_accepted_payout</code>, the author may specify how much of the author reward should be in STEEM Power or liquid rewards.  The most common settings are:</p>

<ul>
  <li><code class="highlighter-rouge">10000</code> - Maximum Liquid Reward</li>
  <li><code class="highlighter-rouge">0</code> - STEEM Power Only</li>
</ul>

<p>Once the payout time has arrived, it’s possible to determine the split between author and curation by inspecting at <code class="highlighter-rouge">author_rewards</code> and <code class="highlighter-rouge">curator_payout_value</code>.</p>

<h4 id="beneficiaries"><code class="highlighter-rouge">beneficiaries</code></h4>

<p>In our script, we use the ruby statement:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">content</span><span class="p">.</span><span class="nf">beneficiaries</span><span class="p">.</span><span class="nf">any?</span>
</code></pre></div></div>

<p>Some content will have a <code class="highlighter-rouge">beneficiaries</code> array.  This is used to determine reward routes any account, up to eight.  Payouts are in STEEM Power and are expressed as a reward percentage of the author reward.</p>

<p>To display a list of who the beneficiaries are, use the following ruby code, as seen in the example:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">content</span><span class="p">.</span><span class="nf">beneficiaries</span><span class="p">.</span><span class="nf">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">beneficiary</span><span class="o">|</span>
  <span class="nb">puts</span> <span class="s2">"</span><span class="se">\t\t</span><span class="si">#{</span><span class="n">beneficiary</span><span class="p">.</span><span class="nf">account</span><span class="si">}</span><span class="s2">: </span><span class="si">#{</span><span class="s1">'%.2f %'</span> <span class="o">%</span> <span class="p">(</span><span class="n">beneficiary</span><span class="p">.</span><span class="nf">weight</span> <span class="o">/</span> <span class="mf">100.0</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
</code></pre></div></div>

<p>Note, if you just want an array of beneficiary account names, this will work in a pinch:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">accounts</span> <span class="o">=</span> <span class="n">content</span><span class="p">.</span><span class="nf">beneficiaries</span><span class="p">.</span><span class="nf">map</span> <span class="k">do</span> <span class="o">|</span><span class="n">beneficiary</span><span class="o">|</span>
  <span class="n">beneficiary</span><span class="p">.</span><span class="nf">account</span>
<span class="k">end</span>
</code></pre></div></div>

<h4 id="active_votes"><code class="highlighter-rouge">active_votes</code></h4>

<p>In our script, we use the ruby statements:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">votes</span> <span class="o">=</span> <span class="n">content</span><span class="p">.</span><span class="nf">active_votes</span>
<span class="n">upvotes</span> <span class="o">=</span> <span class="n">votes</span><span class="p">.</span><span class="nf">select</span> <span class="p">{</span> <span class="o">|</span><span class="n">v</span><span class="o">|</span> <span class="n">v</span><span class="p">.</span><span class="nf">percent</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="p">}.</span><span class="nf">size</span>
<span class="n">downvotes</span> <span class="o">=</span> <span class="n">votes</span><span class="p">.</span><span class="nf">select</span> <span class="p">{</span> <span class="o">|</span><span class="n">v</span><span class="o">|</span> <span class="n">v</span><span class="p">.</span><span class="nf">percent</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="p">}.</span><span class="nf">size</span>
<span class="n">unvotes</span> <span class="o">=</span> <span class="n">votes</span><span class="p">.</span><span class="nf">select</span> <span class="p">{</span> <span class="o">|</span><span class="n">v</span><span class="o">|</span> <span class="n">v</span><span class="p">.</span><span class="nf">percent</span> <span class="o">==</span> <span class="mi">0</span> <span class="p">}.</span><span class="nf">size</span>
<span class="n">top_voter</span> <span class="o">=</span> <span class="n">votes</span><span class="p">.</span><span class="nf">sort_by</span> <span class="p">{</span> <span class="o">|</span><span class="n">v</span><span class="o">|</span> <span class="n">v</span><span class="p">.</span><span class="nf">rshares</span><span class="p">.</span><span class="nf">to_i</span> <span class="p">}.</span><span class="nf">last</span><span class="p">.</span><span class="nf">voter</span>
</code></pre></div></div>

<p>The above idiom splits all vote types and identifies the top voter.  This is because the <code class="highlighter-rouge">active_votes</code> field is an array that shows all votes applied to the content, including upvotes, downvotes, and unvotes (where a vote previously cast is revoked).</p>

<h4 id="json_metadata"><code class="highlighter-rouge">json_metadata</code></h4>

<p>In our script, we use the ruby statements:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">metadata</span> <span class="o">=</span> <span class="no">JSON</span><span class="p">[</span><span class="n">content</span><span class="p">.</span><span class="nf">json_metadata</span> <span class="o">||</span> <span class="s1">'{}'</span><span class="p">]</span> <span class="k">rescue</span> <span class="p">{}</span>
<span class="n">tags</span> <span class="o">=</span> <span class="n">metadata</span><span class="p">[</span><span class="s1">'tags'</span><span class="p">]</span> <span class="o">||</span> <span class="p">[]</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">metadata</span><span class="p">[</span><span class="s1">'app'</span><span class="p">]</span>
</code></pre></div></div>

<p>As you can see from the above example, <code class="highlighter-rouge">json_metadata</code> starts out as a string of JSON that can be parsed to determine things like <code class="highlighter-rouge">tags</code> and <code class="highlighter-rouge">app</code>.  Other data may be present, depending on the application that created the content.</p>

<p>Note, we’re using <code class="highlighter-rouge">rescue</code> in case the <code class="highlighter-rouge">json_metadata</code> string contains invalid JSON because there is no validation performed on this field by the blockchain when content is broadcasted.</p>

<h3 id="to-run">To Run</h3>

<p>First, set up your workstation using the steps provided in <a href="https://developers.steem.io/tutorials-ruby/getting_started">Getting Started</a>.  Then you can create and execute the script (or clone from this repository):</p>

<p>*<code class="highlighter-rouge">&lt;content-url&gt;</code></p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone git@github.com:steemit/devportal-tutorials-rb.git
<span class="nb">cd </span>devportal-tutorials-rb/tutorials/05_get_post_details
bundle <span class="nb">install
</span>ruby get_post_details.rb &lt;content-url&gt;
</code></pre></div></div>

<hr />

</section>

</div>
<div class="footer">
  <a href="#">Back to top</a>
</div>
<script>
    document.getElementById("open-nav").addEventListener("click", function () {
        document.body.classList.toggle("nav-open");
    });
</script>
</body>
</html>


<script src="/js/adjust.js"></script>

